<?php 

include("module.php");

if(isset($_POST["username"]) and $_POST["username"] != "")
{
	$result = mysql_query("select * from user where loginid = " . $_POST["username"]);
	
	while($row = mysql_fetch_array($result))
	{
		if ($_POST["password"] == $row["password"])
		{
			Header("Location:mainpage.php");
		}
		else
		{
			echo "密码错误，请重新输入！";
		}
	}
}


mysql_close($con);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="index.php" method="post">
	<table>
		<tr>
			<td>用户名：</td>
			<td><input name="username" type="text" id="username">
			</td>
		</tr>
		<tr>
			<td>密码：</td>
			<td><input name="password" type="text" id="password">
			</td>
		</tr>
		<tr>
			<td><input name="login" type="submit" type="text" value="确定"
				id="login">
			</td>
		</tr>

	</table>
</form>

</body>
</html>
